/*******************************************************************************
 * Size: 12 px
 * Bpp: 4
 * Opts: --bpp 4 --size 12 --no-compress 
 * 
 *  VBUSIPWR
 ******************************************************************************/
#include "lvgl.h"

#ifndef FONTTIPS_12
#define FONTTIPS_12 1
#endif

#if FONTTIPS_12

/*-----------------
 *    BITMAPS
 *----------------*/

/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
    /* U+0042 "B" */
    0x2f, 0xff, 0xe9, 0x0, 0x2f, 0xd9, 0xdf, 0x60,
    0x2f, 0x90, 0x3f, 0x80, 0x2f, 0xd8, 0xce, 0x20,
    0x2f, 0xff, 0xfe, 0x40, 0x2f, 0x90, 0x1d, 0xe0,
    0x2f, 0x90, 0xb, 0xf0, 0x2f, 0xda, 0xbf, 0xb0,
    0x2f, 0xff, 0xea, 0x10,

    /* U+0049 "I" */
    0x2f, 0x92, 0xf9, 0x2f, 0x92, 0xf9, 0x2f, 0x92,
    0xf9, 0x2f, 0x92, 0xf9, 0x2f, 0x90,

    /* U+0050 "P" */
    0x3f, 0xff, 0xea, 0x10, 0x3f, 0xda, 0xcf, 0xb0,
    0x3f, 0x90, 0xb, 0xf0, 0x3f, 0x90, 0xb, 0xf0,
    0x3f, 0xda, 0xcf, 0xb0, 0x3f, 0xff, 0xea, 0x10,
    0x3f, 0x90, 0x0, 0x0, 0x3f, 0x90, 0x0, 0x0,
    0x3f, 0x90, 0x0, 0x0,

    /* U+0052 "R" */
    0x3f, 0xff, 0xeb, 0x20, 0x3f, 0xd9, 0xdf, 0xd0,
    0x3f, 0x90, 0xa, 0xf2, 0x3f, 0x90, 0x8, 0xf2,
    0x3f, 0x92, 0x5e, 0xd0, 0x3f, 0x98, 0xfb, 0x10,
    0x3f, 0x91, 0xec, 0x0, 0x3f, 0x90, 0x6f, 0x60,
    0x3f, 0x90, 0xd, 0xe1,

    /* U+0053 "S" */
    0x5, 0xdf, 0xc3, 0x3, 0xfe, 0xaf, 0xe0, 0x7f,
    0x60, 0x6a, 0x13, 0xfe, 0x60, 0x0, 0x4, 0xcf,
    0xe4, 0x0, 0x0, 0x4e, 0xf2, 0x8e, 0x30, 0x8f,
    0x54, 0xfe, 0xaf, 0xf1, 0x6, 0xdf, 0xc4, 0x0,

    /* U+0055 "U" */
    0x2f, 0x90, 0x7, 0xf4, 0x2f, 0x90, 0x7, 0xf4,
    0x2f, 0x90, 0x7, 0xf4, 0x2f, 0x90, 0x7, 0xf4,
    0x2f, 0x90, 0x7, 0xf4, 0x2f, 0xa0, 0x8, 0xf4,
    0x1f, 0xd0, 0xb, 0xf2, 0xa, 0xfc, 0xbf, 0xc0,
    0x1, 0x9e, 0xea, 0x10,

    /* U+0056 "V" */
    0xaf, 0x20, 0x0, 0xaf, 0x24, 0xf8, 0x0, 0xf,
    0xc0, 0xe, 0xd0, 0x5, 0xf7, 0x0, 0x9f, 0x20,
    0xaf, 0x10, 0x3, 0xf7, 0xf, 0xb0, 0x0, 0xe,
    0xc5, 0xf6, 0x0, 0x0, 0x8f, 0xcf, 0x0, 0x0,
    0x2, 0xff, 0xa0, 0x0, 0x0, 0xd, 0xf5, 0x0,
    0x0,

    /* U+0057 "W" */
    0xaf, 0x10, 0x1f, 0x80, 0xa, 0xf2, 0x6f, 0x50,
    0x4f, 0xc0, 0xd, 0xe0, 0x2f, 0x90, 0x8f, 0xf0,
    0x1f, 0xa0, 0xe, 0xc0, 0xc9, 0xf4, 0x5f, 0x50,
    0xa, 0xf1, 0xf4, 0xc8, 0x8f, 0x10, 0x6, 0xf8,
    0xf0, 0x8b, 0xcd, 0x0, 0x1, 0xff, 0xc0, 0x5f,
    0xf9, 0x0, 0x0, 0xdf, 0x80, 0x1f, 0xf4, 0x0,
    0x0, 0x9f, 0x40, 0xd, 0xf0, 0x0
};


/*---------------------
 *  GLYPH DESCRIPTION
 *--------------------*/

static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
    {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
    {.bitmap_index = 0, .adv_w = 119, .box_w = 8, .box_h = 9, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 36, .adv_w = 55, .box_w = 3, .box_h = 9, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 50, .adv_w = 116, .box_w = 8, .box_h = 9, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 86, .adv_w = 121, .box_w = 8, .box_h = 9, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 122, .adv_w = 107, .box_w = 7, .box_h = 9, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 154, .adv_w = 130, .box_w = 8, .box_h = 9, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 190, .adv_w = 136, .box_w = 9, .box_h = 9, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 231, .adv_w = 184, .box_w = 12, .box_h = 9, .ofs_x = 0, .ofs_y = 0}
};

/*---------------------
 *  CHARACTER MAPPING
 *--------------------*/

static const uint16_t unicode_list_0[] = {
    0x0, 0x7, 0xe, 0x10, 0x11, 0x13, 0x14, 0x15
};

/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
    {
        .range_start = 66, .range_length = 22, .glyph_id_start = 1,
        .unicode_list = unicode_list_0, .glyph_id_ofs_list = NULL, .list_length = 8, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
    }
};

/*-----------------
 *    KERNING
 *----------------*/


/*Pair left and right glyphs for kerning*/
static const uint8_t kern_pair_glyph_ids[] =
{
    1, 6,
    4, 7
};

/* Kerning between the respective left and right glyphs
 * 4.4 format which needs to scaled with `kern_scale`*/
static const int8_t kern_pair_values[] =
{
    -2, -4
};

/*Collect the kern pair's data in one place*/
static const lv_font_fmt_txt_kern_pair_t kern_pairs =
{
    .glyph_ids = kern_pair_glyph_ids,
    .values = kern_pair_values,
    .pair_cnt = 2,
    .glyph_ids_size = 0
};

/*--------------------
 *  ALL CUSTOM DATA
 *--------------------*/

#if LVGL_VERSION_MAJOR == 8
/*Store all the custom data of the font*/
static  lv_font_fmt_txt_glyph_cache_t cache;
#endif

#if LVGL_VERSION_MAJOR >= 8
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
    .glyph_bitmap = glyph_bitmap,
    .glyph_dsc = glyph_dsc,
    .cmaps = cmaps,
    .kern_dsc = &kern_pairs,
    .kern_scale = 16,
    .cmap_num = 1,
    .bpp = 4,
    .kern_classes = 0,
    .bitmap_format = 0,
#if LVGL_VERSION_MAJOR == 8
    .cache = &cache
#endif
};



/*-----------------
 *  PUBLIC FONT
 *----------------*/

/*Initialize a public general font descriptor*/
#if LVGL_VERSION_MAJOR >= 8
const lv_font_t FontTips_12 = {
#else
lv_font_t FontTips_12 = {
#endif
    .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt,    /*Function pointer to get glyph's data*/
    .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt,    /*Function pointer to get glyph's bitmap*/
    .line_height = 9,          /*The maximum line height required by the font*/
    .base_line = 0,             /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
    .subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
    .underline_position = -1,
    .underline_thickness = 1,
#endif
    .dsc = &font_dsc,          /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
#if LV_VERSION_CHECK(8, 2, 0) || LVGL_VERSION_MAJOR >= 9
    .fallback = NULL,
#endif
    .user_data = NULL,
};



#endif /*#if FONTTIPS_12*/

